package net.office.controller;

import net.office.utils.AuthCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Date;

@Controller
public class UserController {


    /*获取验证码*/
//    @RequestMapping("/getAuthCode.do")
//    public void getVerifyCode(HttpServletRequest request, HttpServletResponse response){
//        String authCode = AuthCode.getAuthCode();
//        request.getSession().setAttribute("authCode", authCode);//保存到session上
//        try{
//            ImageIO.write(AuthCode.getAuthImg(authCode), "JPEG", response.getOutputStream());
//        }catch(IOException e){
//            e.printStackTrace();
//        }
//    }

    /*登录*/
//    @RequestMapping("/login")
//    public String login() {
//        return "user";
//    }
    /*退出*/
//    @RequestMapping("/exit")
//    public String exit() {
//        return "login";
//    }

    //跳转到用户主页面
    @RequestMapping(value="/toUser.do")
    public String toUser(){
        return "user";
    }

    //个人信息
    @RequestMapping("/toPersonal.do")
    public String toPersonal() {
        return "personal";
    }

    //备忘录
    @RequestMapping(value="/toMemo.do")
    public String toMemo(){
        return "memo";
    }
    @RequestMapping(value="/editMemo.do")
    public String editMemo(Model model){
        Date date = new Date();
        model.addAttribute("date1", date);
        return "memo-edit";
    }
    @RequestMapping(value="/addMemo.do")
    public String addMemo(){
        return "memo-add";
    }

    //通讯录
    @RequestMapping(value="/toAddress.do")
    public String toAddress(){
        return "address";
    }
    @RequestMapping(value="/editAddress.do")
    public String editAddress(){
        return "address-edit";
    }
    @RequestMapping(value="/addAddress.do")
    public String addAddress(){
        return "address-add";
    }

    //培训
    @RequestMapping(value="/toTraining.do")
    public String toTraining(){
        return "training";
    }
    @RequestMapping(value="/editTraining.do")
    public String editTraining(){
        return "training-edit";
    }
    @RequestMapping(value="/addTraining.do")
    public String addTraining(){
        return "training-add";
    }

    //报销
    @RequestMapping(value="/toExpense.do")
    public String toExpense(){
        return "expense";
    }
    @RequestMapping(value="/editExpense.do")
    public String editExpense(){
        return "expense-edit";
    }
    @RequestMapping(value="/addExpense.do")
    public String addExpense(){
        return "expense-add";
    }

    //请假
    @RequestMapping(value="/toHoliday.do")
    public String toHoliday(){
        return "holiday";
    }
    @RequestMapping(value="/editHoliday.do")
    public String ediHoliday(){
        return "holiday-edit";
    }
    @RequestMapping(value="/addHoliday.do")
    public String addHoliday(){
        return "holiday-add";
    }

    //公告
    @RequestMapping(value="/toNotice.do")
    public String toNotice(){
        return "notice";
    }
    @RequestMapping(value="/editNotice.do")
    public String editNotice(){
        return "notice-edit";
    }

    //艺人
    @RequestMapping(value="/toArtist.do")
    public String toArtist(){
        return "artist";
    }
    @RequestMapping(value="/editArtist.do")
    public String editArtist(){
        return "artist-edit";
    }
    @RequestMapping(value="/addArtist.do")
    public String addArtist(){
        return "artist-add";
    }

    //简历
    @RequestMapping(value="/toResume.do")
    public String toResume(){
        return "resume";
    }
    @RequestMapping(value="/editResume.do")
    public String editResume(){
        return "resume-edit";
    }
    @RequestMapping(value="/addResume.do")
    public String addResume(){
        return "resume-add";
    }

    //签到
    @RequestMapping(value="/toSign.do")
    public String toSign(){
        return "sign";
    }

    //日志
    @RequestMapping(value="/toDaily.do")
    public String toDaily(){
        return "daily";
    }
    @RequestMapping(value="/editDaily.do")
    public String editDaily(){
        return "daily-edit";
    }
    @RequestMapping(value="/addDaily.do")
    public String addDaily(){
        return "daily-add";
    }

    //报表
    @RequestMapping(value="/toMonthly.do")
    public String toMonthly(){
        return "monthly";
    }
    @RequestMapping(value="/editMonthly.do")
    public String editMonthly(){
        return "monthly-edit";
    }
    @RequestMapping(value="/addMonthly.do")
    public String addMonthly(){
        return "monthly-add";
    }

    //会议
    @RequestMapping(value="/toMeeting.do")
    public String toMeeting(){
        return "meeting";
    }
    @RequestMapping(value="/editMeeting.do")
    public String editMeeting(){
        return "meeting-edit";
    }
    @RequestMapping(value="/addMeeting.do")
    public String addMeeting(){
        return "meeting-add";
    }

    //人员
    @RequestMapping(value="/toStaff.do")
    public String toStaff(){
        return "staff";
    }
    @RequestMapping(value="/editStaff.do")
    public String editStaff(){
        return "staff-edit";
    }
    @RequestMapping(value="/addStaff.do")
    public String addStaff(){
        return "staff-add";
    }

    //权限
    @RequestMapping(value="/toAuthorityStaff.do")
    public String toAuthorityStaff(){
        return "authority-staff";
    }
    @RequestMapping(value="/toAuthorityRole.do")
    public String toAuthorityRole(){
        return "authority-role";
    }
    @RequestMapping(value="/toAuthorityPermission.do")
    public String toAuthorityPermission(){
        return "authority-permission";
    }

    //模块
    @RequestMapping(value="/toModule.do")
    public String toModule(){
        return "module";
    }

    /*测试*/
    @RequestMapping("/test")
    public String test() {
        return "test";
    }
}
